<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf8">
        <title>Zison音乐</title>
        <link href="{{ url_for('static',filename='css/pt_discover_index.css')}}" type="text/css" rel="stylesheet">
        <link href="{{ url_for('static',filename='css/pt_frame.css')}}" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="{{url_for('static',filename='js/jquery-2.2.0.min.js')}}"></script>
        <script type="text/javascript" src="{{url_for('static',filename='js/layer/layer.js')}}"></script>
    </head>
    <body style="background: url(../../static/image/bg.jpg) repeat-y 100% 100%;">
        <div data-module="" data-sub="" id="g_top" class="m-top">
            &nbsp;
        </div>
        <div class="g-bd" style="margin-top:50px">
            <div class="g-wrap" id="baseBox">
                <div class="u-title u-title-2 f-cb">
                    <h3>
                        <span class="f-ff2">后台管理</span>
                    </h3>
                </div>
                <ul class="m-tabs f-cb">
                    <li class="fst">
                        <a href="{{url_for('home.manageArtist')}}" ><em>歌手</em> </a>
                    </li>
                    <li>
                        <a href="{{url_for('home.manageSong')}}" class="z-slt"><em>歌曲</em> </a>
                    </li>
                </ul>
                <div class="g-wrap p-prf">
                    <div class="n-bind f-cb j-flag">
                        <p class="delete">
                            <a target="contentFrame" href={{url_for('home.manageSongAdd')}} class="btn"><i>新增歌曲</i>
                            </a>
                        </p>
                    </div>
                    <div class="u-title u-title-1 f-cb m-record-title" id="rHeader">
                        <h3>
                            <span class="f-ff2 s-fc3">歌曲列表</span>
                        </h3>
                    </div>
                    <div id="m-record" data-uid="3514008" data-songs="1316"
                        class="m-record">
                        <div id="auto-id-oXK37yPmGlBEcCTf">
                            <div class="j-flag" id="auto-id-42i2wAet2Pki6UW6">
                                <table class="m-table m-table-rank">
                                    <thead>
                                        <tr>
                                            <th>
                                                <div class="wp">
                                                    歌曲
                                                </div>
                                            </th>
                                            <th class="wp">
                                                <div class="wp">
                                                    歌手
                                                </div>
                                            </th>
                                            <th class="w3">
                                                <div class="wp">
                                                    类别
                                                </div>
                                            </th>
                                            <th class="w3">
                                                <div class="wp">
                                                    操作
                                                </div>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for song in page_data.items %}
                                        <tr>
                                            <td class="rank">
                                                {{song.songName}}
                                            </td>
                                            <td class=" s-fc3">
                                                {{song.singer}}
                                            </td>
                                            <td class=" s-fc3">
                                               {% if song.style == 1 %}
                                                流行
                                                {% elif song.style == 2%}
                                                R&B
                                                {% elif song.style == 3%}
                                                说唱
                                                {% elif song.style == 4%}
                                                经典
                                                {% elif song.style == 5%}
                                                其他
                                                {% endif %}
                                            </td>
                                            <td class="">
                                                <a href="{{url_for('home.manageSongEdit',id=song.id)}}">修改</a>
                                                <a href="javascript:;" class="del" value="{{song.id}}">删除</a>
                                            </td>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td height="24" align="right">
                                            当前页数：[{{page_data.page}}/{{page_data.pages}}]&nbsp;
                                            <a href="{{ url_for('home.manageSong',page=1) }}">第一页</a>
                                                {% if page_data.has_prev %}
                                                  <a href="{{ url_for('home.manageSong',page=page_data.prev_num) }}">上一页</a>
                                                {% endif %}
                                                {% if page_data.has_next %}
                                            　     <a href="{{ url_for('home.manageSong',page=page_data.next_num) }}">下一页</a>
                                                {% endif %}　
                                            <a href="{{ url_for('home.manageSong',page=page_data.pages) }}">最后一页&nbsp;</a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="j-flag"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script>
        $('.del').click(function(){
            id = $(this).attr('value');
            layer.confirm('确认删除',function(){
                $.ajax({                                    // 使用Ajax异步提交
                    url: "{{ url_for('home.manageSongDel') }}",   // 提交到的URL
                    type: "GET",                            // 提交方式为POST
                    data:{id:id},// 传递参数
                    dataType: "json",                       // 数据类型为json
                    success: function (res) {               // 操作成功后执行逻辑
                        if (res.status == 1) {
                            layer.msg(res.message,{icon:1,time:2000},function(){
                                window.location.href='/manage_artist_list';
                            });
                        } else {
                            layer.msg(res.message,{icon:2,time:2000});   // 提示失败
                        }
                    }
                })
            })
        })
    </script>
    </body>
</html>